<include file="Public/min-header"/>
<!--物流配置 css -start-->
<style>
    ul.group-list {
        width: 96%;min-width: 1000px; margin: auto 5px;list-style: disc outside none;
    }
    ul.group-list li {
        white-space: nowrap;float: left;
        width: 150px; height: 25px;
        padding: 3px 5px;list-style-type: none;
        list-style-position: outside;border: 0px;margin: 0px;
    }
</style>
<!--物流配置 css -end-->

<!--以下是在线编辑器 代码 -->
<script type="text/javascript">
    /*
	 * 在线编辑器相 关配置 js 
	 *  参考 地址 http://fex.baidu.com/ueditor/
	 */
    window.UEDITOR_Admin_URL = "__ROOT__/Public/plugins/Ueditor/";
    var URL_upload = "{$URL_upload}";
    var URL_fileUp = "{$URL_fileUp}";
    var URL_scrawlUp = "{$URL_scrawlUp}";
    var URL_getRemoteImage = "{$URL_getRemoteImage}";
    var URL_imageManager = "{$URL_imageManager}";
    var URL_imageUp = "{$URL_imageUp}";
    var URL_getMovie = "{$URL_getMovie}";
    var URL_home = "{$URL_home}";
</script>
<script type="text/javascript" charset="utf-8" src="__ROOT__/Public/plugins/Ueditor/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="__ROOT__/Public/plugins/Ueditor/ueditor.all.min.js"> </script>
 <script type="text/javascript" charset="utf-8" src="__ROOT__/Public/plugins/Ueditor/lang/zh-cn/zh-cn.js"></script>
<script type="text/javascript">  
  
    var editor;
    $(function () {
        //具体参数配置在  editor_config.js  中
        var options = {
            zIndex: 999,
            initialFrameWidth: "95%", //初化宽度
            initialFrameHeight: 400, //初化高度
            focus: false, //初始化时，是否让编辑器获得焦点true或false
            maximumWords: 99999, removeFormatAttributes: 'class,style,lang,width,height,align,hspace,valign'
            , //允许的最大字符数 'fullscreen',
            pasteplain:false, //是否默认为纯文本粘贴。false为不使用纯文本粘贴，true为使用纯文本粘贴
            autoHeightEnabled: true
         /*   autotypeset: {
                mergeEmptyline: true,        //合并空行
                removeClass: true,           //去掉冗余的class
                removeEmptyline: false,      //去掉空行
                textAlign: "left",           //段落的排版方式，可以是 left,right,center,justify 去掉这个属性表示不执行排版
                imageBlockLine: 'center',    //图片的浮动方式，独占一行剧中,左右浮动，默认: center,left,right,none 去掉这个属性表示不执行排版
                pasteFilter: false,          //根据规则过滤没事粘贴进来的内容
                clearFontSize: false,        //去掉所有的内嵌字号，使用编辑器默认的字号
                clearFontFamily: false,      //去掉所有的内嵌字体，使用编辑器默认的字体
                removeEmptyNode: false,      //去掉空节点
                                             //可以去掉的标签
                removeTagNames: {"font": 1},
                indent: false,               // 行首缩进
                indentValue: '0em'           //行首缩进的大小
            }*/,
        	toolbars: [
                   ['fullscreen', 'source', '|', 'undo', 'redo',
                       '|', 'bold', 'italic', 'underline', 'fontborder',
                       'strikethrough', 'superscript', 'subscript',
                       'removeformat', 'formatmatch', 'autotypeset',
                       'blockquote', 'pasteplain', '|', 'forecolor',
                       'backcolor', 'insertorderedlist',
                       'insertunorderedlist', 'selectall', 'cleardoc', '|',
                       'rowspacingtop', 'rowspacingbottom', 'lineheight', '|',
                       'customstyle', 'paragraph', 'fontfamily', 'fontsize',
                       '|', 'directionalityltr', 'directionalityrtl',
                       'indent', '|', 'justifyleft', 'justifycenter',
                       'justifyright', 'justifyjustify', '|', 'touppercase',
                       'tolowercase', '|', 'link', 'unlink', 'anchor', '|',
                       'imagenone', 'imageleft', 'imageright', 'imagecenter',
                       '|', 'insertimage', 'emotion', 'insertvideo',
                       'attachment', 'map', 'gmap', 'insertframe',
                       'insertcode', 'webapp', 'pagebreak', 'template',
                       'background', '|', 'horizontal', 'date', 'time',
                       'spechars', 'wordimage', '|',
                       'inserttable', 'deletetable',
                       'insertparagraphbeforetable', 'insertrow', 'deleterow',
                       'insertcol', 'deletecol', 'mergecells', 'mergeright',
                       'mergedown', 'splittocells', 'splittorows',
                       'splittocols', '|', 'print', 'preview', 'searchreplace']
               ]
        };
        editor = new UE.ui.Editor(options);
        editor.render("goods_content");  //  指定 textarea 的  id 为 goods_content

    }); 
</script>
<!--以上是在线编辑器 代码  end-->
<div class="wrapper">
    <include file="Public/breadcrumb"/>
    <section class="content">
        <!-- Main content -->
        <div class="container-fluid">
            <div class="pull-right">
                <a href="javascript:history.go(-1)" data-toggle="tooltip" title="" class="btn btn-default" data-original-title="返回"><i class="fa fa-reply"></i></a>
            	<a href="javascript:;" class="btn btn-default" data-url="http://www.tp-shop.cn/Doc/Index/article/id/1007/developer/user.html" onclick="get_help(this)"><i class="fa fa-question-circle"></i> 帮助</a>
            </div>
            <div class="panel panel-default">
                <div class="panel-heading">
                    <h3 class="panel-title"><i class="fa fa-list"></i>商品详情</h3>
                </div>
                <div class="panel-body">
                    <ul class="nav nav-tabs">
                        <li class="active"><a href="#tab_tongyong" data-toggle="tab">通用信息</a></li>
<!--                        <li><a href="#tab_goods_desc" data-toggle="tab">描述信息</a></li>-->
                        <li><a href="#tab_goods_images" data-toggle="tab">商品相册</a></li>
                        <li><a href="#tab_goods_spec" data-toggle="tab">商品规格</a></li>                        
                        <li><a href="#tab_goods_attr" data-toggle="tab">商品属性</a></li>
                        
                        <li><a href="#tab_goods_tem" data-toggle="tab">商品尺寸表</a></li>
                        <li><a href="#tab_goods_shipping" data-toggle="tab">商品物流</a></li>
                    </ul>
                    <!--表单数据-->
                    <form method="post" id="addEditGoodsForm">
                    
                        <!--通用信息-->
                    <div class="tab-content">                 	  
                        <div class="tab-pane active" id="tab_tongyong">
                           
                            <table class="table table-bordered">
                                <tbody>
                                <tr>
                                    <td>商品名称（繁体）:</td>
                                    <td>
                                        <input type="text" value="{$goodsInfo.goods_name}" name="goods_name" class="form-control" style="width:550px;"/>
                                        <span id="err_goods_name" style="color:#F00; display:none;"></span>                                        
                                    </td>
                                </tr>
								
								  <tr>
                                    <td>商品地区:</td>
                                    <td>
									<select name="lang_id" id="lang_id" class="form-control" style="width:250px;">
                          
                                            <foreach name="goodsLang" item="v" key="k" >
                                               <option value="{$v['id']}"  <if condition="$v['id'] eq $goodsInfo['lang_id'] ">selected="selected"</if>>
                                               		{$v['name']}
                                               </option>
                                        	 </foreach>
                                      </select>                                    
                                    </td>
                                </tr>
                               <!--  <tr>
                                    <td>商品名称（香港）:</td>
                                    <td>
                                        <input type="text" value="{$goodsInfo.goods_name_hk}" name="goods_name_hk" class="form-control" style="width:550px;"/>
                                        <span id="err_goods_name" style="color:#F00; display:none;"></span>                                        
                                    </td>
                                </tr>
                                <tr>
                                    <td>商品名称(台湾）:</td>
                                    <td>
                                        <input type="text" value="{$goodsInfo.goods_name_tw}" name="goods_name_tw" class="form-control" style="width:550px;"/>
                                        <span id="err_goods_name" style="color:#F00; display:none;"></span>                                        
                                    </td>
                                </tr>
                                <tr>
                                    <td>商品名称(日本）:</td>
                                    <td>
                                        <input type="text" value="{$goodsInfo.goods_name_jp}" name="goods_name_jp" class="form-control" style="width:550px;"/>
                                        <span id="err_goods_name" style="color:#F00; display:none;"></span>                                        
                                    </td>
                                </tr> -->
                                <tr>
                                    <td>商品简介:</td>
                                    <td>
	                                    <textarea rows="3" cols="80" name="goods_remark">{$goodsInfo.goods_remark}</textarea>
                                        <span id="err_goods_remark" style="color:#F00; display:none;"></span>
                                         
                                    </td>                                                                       
                                </tr>
                                <tr>
                                    <td>商品货号</td>
                                    <td>                                                                               
                                        <input type="text" value="{$goodsInfo.goods_sn}" name="goods_sn" class="form-control" style="width:350px;"/>
                                        <span id="err_goods_sn" style="color:#F00; display:none;"></span>
                                    </td>
                                </tr>
                                <tr>
                                    <td>SPU</td>
                                    <td>                                                                               
                                        <input type="text" value="{$goodsInfo.spu}" name="spu" class="form-control" style="width:350px;"/>
                                        <span id="err_goods_spu" style="color:#F00; display:none;"></span>
                                    </td>
                                </tr>
                                <tr>
                                    <td>SKU</td>
                                    <td>                                                                               
                                        <input type="text" value="{$goodsInfo.sku}" name="sku" class="form-control" style="width:350px;"/>
                                        <span id="err_goods_sku" style="color:#F00; display:none;"></span>
                                    </td>
                                </tr>                                
                                <tr>
                                    <td>商品分类:</td>
                                    <td>
                                      <div class="col-xs-3">
                                      <select name="cat_id" id="cat_id" onchange="get_category(this.value,'cat_id_2','0');" class="form-control" style="width:250px;margin-left:-15px;">
                                        <option value="0">请选择商品分类</option>                                      
                                             <foreach name="cat_list" item="v" key="k" >                                                                                          
                                               <option value="{$v['id']}" <if condition="$v['id'] eq $level_cat['1']">selected="selected"</if> >
                                               		{$v['name']}
                                               </option>
                                             </foreach>
                                      </select>
                                      </div>
                                      <div class="col-xs-3">
                                      <select name="cat_id_2" id="cat_id_2" onchange="get_category(this.value,'cat_id_3','0');" class="form-control" style="width:250px;margin-left:-15px;">
                                        <option value="0">请选择商品分类</option>
                                      </select>  
                                      </div>
                                      <div class="col-xs-3">                        
                                      <select name="cat_id_3" id="cat_id_3" class="form-control" style="width:250px;margin-left:-15px;">
                                        <option value="0">请选择商品分类</option>
                                      </select> 
                                      </div>    
                                      <span id="err_cat_id" style="color:#F00; display:none;"></span>                                 
                                    </td>
                                </tr>                                 
                                <tr>
                                    <td>扩展分类:</td>
                                    <td>
                                      <div class="col-xs-3">
                                      <select name="extend_cat_id" id="extend_cat_id" onchange="get_category(this.value,'extend_cat_id_2','0');" class="form-control" style="width:250px;margin-left:-15px;">
                                        <option value="0">请选择商品分类</option>                                      
                                             <foreach name="cat_list" item="v" key="k" >                                                                                          
                                               <option value="{$v['id']}" <if condition="$v['id'] eq $level_cat2['1']">selected="selected"</if> >
                                               		{$v['name']}
                                               </option>
                                             </foreach>
                                      </select>
                                      </div>
                                      <div class="col-xs-3">
                                      <select name="extend_cat_id_2" id="extend_cat_id_2" onchange="get_category(this.value,'extend_cat_id_3','0');" class="form-control" style="width:250px;margin-left:-15px;">
                                        <option value="0">请选择商品分类</option>
                                      </select>  
                                      </div>
                                      <div class="col-xs-3">                        
                                      <select name="extend_cat_id_3" id="extend_cat_id_3" class="form-control" style="width:250px;margin-left:-15px;">
                                        <option value="0">请选择商品分类</option>
                                      </select> 
                                      </div>    
                                      <span id="err_cat_id" style="color:#F00; display:none;"></span>                                 
                                    </td>
                                </tr>                                 
                                
<!--
                                <tr>
                                    <td>商品分类:</td>
                                    <td>
                                      <select name="cat_id" id="cat_id" class="form-control" style="width:250px;">
                                        <option value="">所有分类</option>
                                             <foreach name="cat_list" item="v" key="k" >                                                                                          
                                               <option value="{$v['id']}" <if condition="$v['id'] eq $goodsInfo['cat_id'] ">selected="selected"</if> >
                                               		<?php echo  str_pad('',($v[level] * 5),'-',STR_PAD_LEFT);  ?> {$v['name']}
                                               </option>
                                             </foreach>
                                      </select>                                    
                                    </td>
                                </tr>
-->                                
                                <tr>
                                    <td>商品品牌:</td>
                                    <td>
									<select name="brand_id" id="brand_id" class="form-control" style="width:250px;">
                                       		 <option value="">所有品牌</option>
                                            <foreach name="brandList" item="v" key="k" >
                                               <option value="{$v['id']}"  <if condition="$v['id'] eq $goodsInfo['brand_id'] ">selected="selected"</if>>
                                               		{$v['name']}
                                               </option>
                                        	 </foreach>
                                      </select>                                    
                                    </td>
                                </tr>
                                <tr>
                                    <td>供应商:</td>
                                    <td>
                                        <select name="suppliers_id" id="suppliers_id" class="form-control" style="width:250px;">
                                            <option value="0">不指定供应商属于本店商品</option>
                                            <foreach name="suppliersList" item="v" key="k" >
                                                <option value="{$v['suppliers_id']}"  <if condition="$v['suppliers_id'] eq $goodsInfo['suppliers_id'] ">selected="selected"</if>>
                                                {$v['suppliers_name']}
                                                </option>
                                            </foreach>
                                        </select>
                                    </td>
                                </tr>
                                <tr>
                                    <td>本店售价:</td>
                                    <td>
                                        <input type="text" value="{$goodsInfo.shop_price}" name="shop_price" class="form-control" style="width:150px;" onkeyup="this.value=this.value.replace(/[^\d.]/g,'')" onpaste="this.value=this.value.replace(/[^\d.]/g,'')" />
                                        <span id="err_shop_price" style="color:#F00; display:none;"></span>					                                        
                                    </td>
                                </tr>  
                                <tr>
                                    <td>市场价:</td>
                                    <td>
                                        <input type="text" value="{$goodsInfo.market_price}" name="market_price" class="form-control" style="width:150px;" onkeyup="this.value=this.value.replace(/[^\d.]/g,'')" onpaste="this.value=this.value.replace(/[^\d.]/g,'')" />
                                        <span id="err_market_price" style="color:#F00; display:none;"></span>					                                        
                                    </td>
                                </tr>  
                                <tr>
                                    <td>成本价:</td>
                                    <td>
                                        <input type="text" value="{$goodsInfo.cost_price}" name="cost_price" class="form-control" style="width:150px;" onkeyup="this.value=this.value.replace(/[^\d.]/g,'')" onpaste="this.value=this.value.replace(/[^\d.]/g,'')" />
                                        <span id="err_cost_price" style="color:#F00; display:none"></span>					                                        
                                    </td>
                                </tr>       
                                <tr>
                                    <td>佣金:</td>
                                    <td>
                                        <input type="text" value="{$goodsInfo.commission}" name="commission" class="form-control" style="width:150px;" onkeyup="this.value=this.value.replace(/[^\d.]/g,'')" onpaste="this.value=this.value.replace(/[^\d.]/g,'')" />
                                        用于分销的分成金额
                                    </td>
                                </tr>                                  
                                <tr>
                                    <td>上传商品图片:</td>
                                    <td>
                                        <input type="button" value="上传图片"  onclick="GetUploadify(1,'','goods','call_back');"/>
                                        <input type="text" class="input-sm"  name="original_img" id="original_img" value="{$goodsInfo.original_img}"/>
                                        <if condition="$goodsInfo['original_img'] neq null">
                                            &nbsp;&nbsp;
                                            <a target="_blank" href="{$goodsInfo.original_img}" id="original_img2">
                                                <img width="25" height="25" src="/Public/images/image_icon.jpg">
                                            </a>
                                        </if>
                                        <span id="err_original_img" style="color:#F00; display:none;"></span>					                                        
                                    </td>
                                </tr>        
								
								 <tr>
                                    <td>上传商品模特图片:</td>
                                    <td>
                                        <input type="button" value="上传图片"  onclick="GetUploadify(1,'','goods','call_back_img1');"/>
                                        <input type="text" class="input-sm"  name="original_img1" id="original_img1" value="{$goodsInfo.original_img1}"/>
                                        <if condition="$goodsInfo['original_img1'] neq null">
                                            &nbsp;&nbsp;
                                            <a target="_blank" href="{$goodsInfo.original_img1}" id="original_img3">
                                                <img width="25" height="25" src="/Public/images/image_icon.jpg">
                                            </a>
                                        </if>
                                        <span id="err_original_img" style="color:#F00; display:none;"></span>					                                        
                                    </td>
                                </tr>                                                          
                                <tr>
                                    <td>商品重量:</td>
                                    <td>
                                        <input type="text" class="form-control" style="width:150px;" value="{$goodsInfo.weight}" name="weight" onkeyup="this.value=this.value.replace(/[^\d.]/g,'')" onpaste="this.value=this.value.replace(/[^\d.]/g,'')" />
                                        &nbsp;克 (以克为单位)                                        
                                        <span id="err_weight" style="color:#F00; display:none;"></span>
                                    </td>
                                </tr>
                                <tr>
                                    <td>是否包邮:</td>
                                    <td>
                                        是:<input type="radio" <if condition="$goodsInfo[is_free_shipping] eq 1">checked="checked"</if> value="1" name="is_free_shipping" /> 
                                        否:<input type="radio" <if condition="$goodsInfo[is_free_shipping] eq 0">checked="checked"</if> value="0" name="is_free_shipping" /> 
                                    </td>
                                </tr>                                
                                <tr>
                                    <td>库存数量:</td>
                                    <td>
                                        <if condition="$goodsInfo[goods_id] gt 0">
                                            <input type="text" value="{$goodsInfo.store_count}" class="form-control" style="width:150px;" name="store_count" onkeyup="this.value=this.value.replace(/[^\d.]/g,'')" onpaste="this.value=this.value.replace(/[^\d.]/g,'')" />
                                        <else />
                                            <input type="text" value="{$tpshop_config[basic_default_storage]}" class="form-control" style="width:150px;" name="store_count" onkeyup="this.value=this.value.replace(/[^\d.]/g,'')" onpaste="this.value=this.value.replace(/[^\d.]/g,'')" />                                         
                                        </if>
                                        
                                        <span id="err_store_count" style="color:#F00; display:none;"></span>					                                        
                                    </td>
                                </tr>
                                <tr>
                                    <td>赠送积分:</td>
                                    <td>
                                        <input type="text" class="form-control" style="width:150px;" value="{$goodsInfo.give_integral}" name="give_integral" onkeyup="this.value=this.value.replace(/[^\d.]/g,'')" onpaste="this.value=this.value.replace(/[^\d.]/g,'')" />
                                        <span id="err_give_integral" style="color:#F00; display:none;"></span>					                                        
                                    </td>
                                </tr>
                                <tr>
                                    <td>兑换积分:</td>
                                    <td>
                                        <input type="text" class="form-control" style="width:150px;" value="{$goodsInfo.exchange_integral}" name="exchange_integral" onkeyup="this.value=this.value.replace(/[^\d.]/g,'')" onpaste="this.value=this.value.replace(/[^\d.]/g,'')" />
                                        <span id="err_exchange_integral" style="color:#F00; display:none;"></span>
                                    </td>
                                </tr>
                                <!--
                                <tr>
                                    <td>设置:</td>
                                    <td>
                                    	<input type="checkbox" checked="checked" value="{$goodsInfo.is_on_sale}" name="is_on_sale"/> 上架&nbsp;&nbsp;
	                                <input type="checkbox" checked="checked" value="{$goodsInfo.is_free_shipping}" name="is_free_shipping"/> 包邮&nbsp;&nbsp;
                                        <input type="checkbox" checked="checked" value="{$goodsInfo.is_recommend}" name="is_recommend"/>推荐&nbsp;&nbsp;
                                        <input type="checkbox" checked="checked" value="{$goodsInfo.is_new}" name="is_new"/>新品&nbsp;&nbsp;
                                    </td>
                                </tr>
                                -->
                                <tr>
                                    <td>商品关键词:</td>
                                    <td>
                                        <input type="text" class="form-control" style="width:550px;" value="{$goodsInfo.keywords}" name="keywords"/>用空格分隔
                                        <span id="err_keywords" style="color:#F00; display:none;"></span>
                                    </td>
                                </tr>                                    
                                <tr>
                                    <td>商品详情描述:</td>
                                    <td width="85%">
										<textarea class="span12 ckeditor" id="goods_content" name="goods_content" title="">{$goodsInfo.goods_content}</textarea>
                                        <span id="err_goods_content" style="color:#F00; display:none;"></span>                                         
                                    </td>                                                                       
                                </tr>   
                                </tbody>                                
                                </table>
                        </div>
                         <!--其他信息-->
                         
                        <!-- 商品相册-->
                        <div class="tab-pane" id="tab_goods_images">
                            <table class="table table-bordered">
                                <tbody>
                                <tr>                                    
                                    <td>                                    
                                    <foreach name="goodsImages" item="vo" key="k" >
                                        <div style="width:100px; text-align:center; margin: 5px; display:inline-block;" class="goods_xc">
                                            <input type="hidden" value="{$vo['image_url']}" name="goods_images[]">
                                            <a onclick="" href="{$vo['image_url']}" target="_blank"><img width="100" height="100" src="{$vo['image_url']}"></a>
                                            <br>
                                            <a href="javascript:void(0)" onclick="ClearPicArr2(this,'{$vo['image_url']}')">删除</a>
                                        </div>
                                    </foreach>
                                    
                                        <div class="goods_xc" style="width:100px; text-align:center; margin: 5px; display:inline-block;">
                                            <input type="hidden" name="goods_images[]" value="" />
                                            <a href="javascript:void(0);" onclick="GetUploadify(10,'','goods','call_back2');"><img src="/Public/images/add-button.jpg" width="100" height="100" /></a>
                                            <br/>
                                            <a href="javascript:void(0)">&nbsp;&nbsp;</a>
                                        </div>                                        
                                    </td>
                                </tr>                                              
                                </tbody>
                            </table>
                        </div>
                         <!--商品相册--> 
   
                        <!-- 商品规格-->
                        <div class="tab-pane" id="tab_goods_spec">
                            <table class="table table-bordered" id="goods_spec_table">                                
                                <tr>
                                    <td>商品类型:</td>
                                    <td>                                        
                                      <select name="spec_type" id="spec_type" class="form-control" style="width:250px;">
                                        <option value="0">选择商品类型</option>
                                        <foreach name="goodsType" item="vo" key="k" >
                                            <option value="{$vo.id}"<if condition="$goodsInfo[spec_type] eq $vo[id]"> selected="selected" </if> >{$vo.name}</option>
                                        </foreach>                                        
                                      </select>
                                    </td>
                                </tr>     
                                                           
                            </table>
                            <div id="ajax_spec_data"><!-- ajax 返回规格--></div>
                        </div>
                        <!-- 商品规格-->

                        <!-- 商品属性-->
                        <div class="tab-pane" id="tab_goods_attr">
                            <table class="table table-bordered" id="goods_attr_table">                                
                                <tr>
                                    <td>商品属性:</td>
                                    <td>                                        
                                      <select name="goods_type" id="goods_type" class="form-control" style="width:250px;">
                                        <option value="0">选择商品属性</option>
                                        <foreach name="goodsType" item="vo" key="k" >
                                            <option value="{$vo.id}"<if condition="$goodsInfo[goods_type] eq $vo[id]"> selected="selected" </if> >{$vo.name}</option>
                                        </foreach>                                        
                                      </select>
                                    </td>
                                </tr>                                
                            </table>
                        </div>
                        <!-- 商品属性-->

                       
                       
                        <!-- 商品模板-->
                        <div class="tab-pane" id="tab_goods_tem">
                        	 <table class="table table-bordered" >
                                <tr>
                                    <td colspan="2" align="right">
                                    <a href="{:U('Goods/goodsTemplate')}" style="width: 100px;height: 40px;line-height: 40px;background: #000;color:#fff;display: block;text-align: center;" target="_blank">模板添加/修改</a></td>

                                </tr>
                               <tr>
                                    <td>商品尺码信息:</td>
                                    <td>
                                      <select name="goods_temid" id="goods_temid" class="form-control" style="width:250px;">
                                        <option value="0">选择商品尺码信息</option>
                                        <foreach name="goodsTem" item="vo" key="k" >
                                            <option value="{$vo.id}"<if condition="$goodsInfo[goods_temid] eq $vo[id]"> selected="selected" </if> >{$vo.name}</option>
                                        </foreach>
                                      </select>
                                    </td>
                                </tr>
                                <tr>
                                	<td colspan="2"><div id="goods_temid_table">

                                		<if condition="$goodsInfo[goods_temid] neq ''" >
                                		<table style="width: 100%;"  cellpadding="0" cellspacing="0" >
		<tr>
		<tpshop sql="select goods_type from `__PREFIX__goods_template` where parentid=$goodsInfo[goods_temid] limit 0,1" key="k4" item='v4'>
					<tpshop sql="select attr_name from `__PREFIX__goods_attribute` where type_id=$v4[goods_type] order by attr_id asc" key="k5" item='v5'>
						<td style="border: 1px solid #eee;padding:3px;background: #000;color: #fff; text-align: center;">{$v5.attr_name}</td>
					</tpshop>
			</tpshop>
		</tr>

			<tpshop sql="select id from `__PREFIX__goods_template` where parentid=$goodsInfo[goods_temid]" key="k2" item='v2'>
				<tr>
					<tpshop sql="select attr_value from `__PREFIX__goods_attr` where tem_id=$v2[id] order by attr_id asc" key="k3" item='v3'>
						<td style="border: 1px solid #eee;padding:3px; text-align: center;">{$v3.attr_value}</td>
					</tpshop>
				</tr>
			</tpshop>
	</table></if>

                                	</div></td>
                                </tr>
                                <tr>
                                    <td>商品尺码图:</td>
                                    <td>
                                      <select name="goods_size_temid" id="goods_size_temid" class="form-control" style="width:250px;">
                                        <option value="0">选择商品尺码图</option>
                                        <foreach name="goodsTemsize" item="vo" key="k" >
                                            <option value="{$vo.id}"<if condition="$goodsInfo[goods_size_temid] eq $vo[id]"> selected="selected" </if> >{$vo.name}</option>
                                        </foreach>
                                      </select>
                                    </td>
                                </tr>
                                <tr>
                                	<td colspan="2">


                                        <div id="goods_size_temid_table">
                                            <if condition="$goodsInfo[goods_size_temid] neq ''">
       <tpshop sql="select * from `__PREFIX__goods_template` where id=$goodsInfo[goods_size_temid]" key="k2" item='v2'>
       <center><img src="{$v2.original_img}" alt=""></center>
			</tpshop></if> </div></td>
                                </tr>


                            </table>
						</div>
                      	<!-- 商品模板-->
                       
                        <!-- 商品物流-->
                        <div class="tab-pane" id="tab_goods_shipping">
                            <h4><b>物流配送：</b><input type="checkbox" onclick="choosebox(this)">全选</h4>
                            <table class="table table-bordered table-striped dataTable" id="goods_shipping_table">
                                <foreach name="plugin_shipping" item="shipping" key="kk">
                                    <tr>
                                        <td class="title left" style="padding-right:50px;">
                                            <b>{$shipping[name]}：</b>
                                            <label class="right"><input type="checkbox" value="1" cka="mod-{$kk}">全选</label>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <ul class="group-list">
                                                <foreach name="shipping_area" item="vv">
                                                    <if condition="$vv[shipping_code] eq $shipping[code]">
                                                        <li><label><input type="checkbox" name="shipping_area_ids[]" value="{$vv.shipping_area_id}" <if condition="in_array($vv['shipping_area_id'],$goods_shipping_area_ids)">checked='checked='</if> ck="mod-{$kk}">{$vv.shipping_area_name}</label></li>
                                                    </if>
                                                </foreach>
                                                <div class="clear-both"></div>
                                            </ul>
                                        </td>
                                    </tr>
                                </foreach>
                            </table>
                        </div>
                        <!-- 商品物流-->
                    </div>              
                    <div class="pull-right">
                        <input type="hidden" name="goods_id" value="{$goodsInfo.goods_id}">
                        <button class="btn btn-primary" onclick="ajax_submit_form('addEditGoodsForm','{:U('Goods/addEditGoods?is_ajax=1')}');" title="" data-toggle="tooltip" type="button" data-original-title="保存">保存</button>
                    </div>
			    </form><!--表单数据-->
                </div>
            </div>
        </div>    <!-- /.content -->
    </section>
</div>
<script>
    $(document).ready(function(){
        $(":checkbox[cka]").click(function(){
            var $cks = $(":checkbox[ck='"+$(this).attr("cka")+"']");
            if($(this).is(':checked')){
                $cks.each(function(){$(this).prop("checked",true);});
            }else{
                $cks.each(function(){$(this).removeAttr('checked');});
            }
        });
    });

    function choosebox(o){
        var vt = $(o).is(':checked');
        if(vt){
            $('input[type=checkbox]').prop('checked',vt);
        }else{
            $('input[type=checkbox]').removeAttr('checked');
        }
    }
    /*
     * 以下是图片上传方法
     */
    // 上传商品图片成功回调函数
    function call_back(fileurl_tmp){
        $("#original_img").val(fileurl_tmp);
    	$("#original_img2").attr('href', fileurl_tmp);
    }
 
    // 上传商品图片成功回调函数
    function call_back_img1(fileurl_tmp){
        $("#original_img1").val(fileurl_tmp);
    	$("#original_img3").attr('href', fileurl_tmp);
    }
    // 上传商品相册回调函数
    function call_back2(paths){
        
        var  last_div = $(".goods_xc:last").prop("outerHTML");	
        for (i=0;i<paths.length ;i++ )
        {                    
            $(".goods_xc:eq(0)").before(last_div);	// 插入一个 新图片
                $(".goods_xc:eq(0)").find('a:eq(0)').attr('href',paths[i]).attr('onclick','').attr('target', "_blank");// 修改他的链接地址
            $(".goods_xc:eq(0)").find('img').attr('src',paths[i]);// 修改他的图片路径
                $(".goods_xc:eq(0)").find('a:eq(1)').attr('onclick',"ClearPicArr2(this,'"+paths[i]+"')").text('删除');
            $(".goods_xc:eq(0)").find('input').val(paths[i]); // 设置隐藏域 要提交的值
        } 			   
    }
    /*
     * 上传之后删除组图input     
     * @access   public
     * @val      string  删除的图片input
     */
    function ClearPicArr2(obj,path)
    {
    	$.ajax({
                    type:'GET',
                    url:"{:U('Admin/Uploadify/delupload')}",
                    data:{action:"del", filename:path},
                    success:function(){
                           $(obj).parent().remove(); // 删除完服务器的, 再删除 html上的图片				 
                    }
		});
		// 删除数据库记录
    	$.ajax({
                    type:'GET',
                    url:"{:U('/Admin/Goods/del_goods_images')}",
                    data:{filename:path},
                    success:function(){
                          //		 
                    }
		});		
    }
 


/** 以下 商品属性相关 js*/
$(document).ready(function(){
	
	$("#goods_temid").change(function(){        
        var type_id = $(this).val();
            $.ajax({
                    type:'GET',
                    data:{type_id:type_id}, 
                    url:"/admin/Goods/ajaxGetSize",
                    success:function(data){      
                            $("#goods_temid_table").html('');              
                            $("#goods_temid_table").append(data);
                    }        
            });			                
    });
	
	$("#goods_size_temid").change(function(){        
        var type_id = $(this).val();
            $.ajax({
                    type:'GET',
                    data:{type_id:type_id}, 
                    url:"/admin/Goods/ajaxGetSize",
                    success:function(data){      
                            $("#goods_size_temid_table").html('');              
                            $("#goods_size_temid_table").append(data);
                    }        
            });			                
    });
    // 商品类型切换时 ajax 调用  返回不同的属性输入框
    $("#goods_type").change(function(){        
        var goods_id = $("input[name='goods_id']").val();
        var type_id = $(this).val();
            $.ajax({
                    type:'GET',
                    data:{goods_id:goods_id,type_id:type_id}, 
                    url:"/admin/Goods/ajaxGetAttrInput",
                    success:function(data){                            
                            $("#goods_attr_table tr:gt(0)").remove()
                            $("#goods_attr_table").append(data);
                    }        
            });			                
    });
	// 触发商品类型
	$("#goods_type").trigger('change');
    $("input[name='exchange_integral']").blur(function(){
        var shop_price = parseInt($("input[name='shop_price']").val());
        var exchange_integral = parseInt($(this).val());
        if (shop_price * 100 < exchange_integral) {

        }
    });
});
 

// 属性输入框的加减事件
function addAttr(a)
{
	var attr = $(a).parent().parent().prop("outerHTML");	
	attr = attr.replace('addAttr','delAttr').replace('+','-');	
	$(a).parent().parent().after(attr);
}
// 属性输入框的加减事件
function delAttr(a)
{
   $(a).parent().parent().remove();
}
 

/** 以下 商品规格相关 js*/
$(document).ready(function(){
	
    // 商品类型切换时 ajax 调用  返回不同的属性输入框
    $("#spec_type").change(function(){        
        var goods_id = '{$goodsInfo.goods_id}';
        var spec_type = $(this).val();
            $.ajax({
                    type:'GET',
                    data:{goods_id:goods_id,spec_type:spec_type}, 
                    url:"{:U('/admin/Goods/ajaxGetSpecSelect')}",
                    success:function(data){                            
                           $("#ajax_spec_data").html('')
                           $("#ajax_spec_data").append(data);
						   //alert('132');
						   ajaxGetSpecInput();	// 触发完  马上处罚 规格输入框
                    }
            });			                
    });
	// 触发商品规格
	$("#spec_type").trigger('change'); 
});

/** 以下是编辑时默认选中某个商品分类*/
$(document).ready(function(){

	<if condition="$level_cat['2'] gt 0">
		 // 商品分类第二个下拉菜单
		 get_category('{$level_cat[1]}','cat_id_2','{$level_cat[2]}');	
	</if>
	<if condition="$level_cat['3'] gt 0">
		// 商品分类第二个下拉菜单
		 get_category('{$level_cat[2]}','cat_id_3','{$level_cat[3]}');	 
	</if>

    //  扩展分类
	<if condition="$level_cat2['2'] gt 0">
		 // 商品分类第二个下拉菜单
		 get_category('{$level_cat2[1]}','extend_cat_id_2','{$level_cat2[2]}');	
	</if>
	<if condition="$level_cat2['3'] gt 0">
		// 商品分类第二个下拉菜单
		 get_category('{$level_cat2[2]}','extend_cat_id_3','{$level_cat2[3]}');	 
	</if>

});

</script>
</body>
</html>